﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PloobsEngine.SceneControl;
using PloobsEngine.Physics;
using PloobsEngine.Modelo;
using PloobsEngine.Material;
using PloobsEngine.Engine;
using PloobsEngine.Light;
using PloobsEngine.Physics.Bepu;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Graphics;
using PloobsEngine.Cameras;
using PloobsEngine.Input;
using PloobsEngine.Entity;
using PloobsEngine.MessageSystem;

namespace PloobsProjectTemplate
{
    public abstract class GameObject3D : IObject    
    {
        /// <summary>
        /// Define o shader a ser utilzado
        /// </summary>
        private IShader shader;

        public IShader Shader
        {
            get { return shader; }
            set { shader = value; }
        }

        private Vector3 linearVelocity;

        public Vector3 LinearVelocity
        {
            get { return linearVelocity; }
            set 
            {
                this.PhysicObject.Velocity = value;
                linearVelocity = value; 
            }
        }

        private Vector3 angularVelocity;

        public Vector3 AngularVelocity
        {
            get { return angularVelocity; }
            set 
            {
                this.PhysicObject.AngularVelocity = value;
                angularVelocity = value; 
            }
        }

        public float leftRightRot = 0;

        public float upDownRot = 0;
    
        
        public GameObject3D(IPhysicObject physicsObject, IMaterial material, IModelo model)
            : base(material, model, physicsObject)
        {
            this.Modelo = model;
            this.Material = material;
            this.PhysicObject = physicsObject;
        }

        public GameObject3D(IPhysicObject physicsObject, IMaterial material, IModelo model, 
                            Vector3 LinearVelocity, Vector3 AngularVelcoity)
            : base(material, model, physicsObject)
        {
            this.Modelo = model;
            this.Material = material;
            this.PhysicObject = physicsObject;
            this.AngularVelocity = AngularVelcoity;
            this.LinearVelocity = LinearVelocity;
        }

        
        //public GameObject3D(IPhysicObject physicsObject, IMaterial material, IModelo model)
        //{
        //    this.PhysicObject = physicsObject;
        //    this.Material = material;
        //    this.Modelo = model;
        //}

        //public abstract void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager);

        protected override void UpdateObject(GameTime gt, ICamera cam, IWorld world)
        {
            base.UpdateObject(gt, cam, world);
        }

        protected abstract void ConfigTexture();
        
    }
}
